from Page.Page1 import Page1
from selenium.webdriver.common.by import By
class Page2(Page1):
    # 1.输入框输入
    search_loc=(By.XPATH,'//*[@id="kw"]')
    def search(self):
        self.send_keys(self.search_loc,'手机')
    # 2.点击百度一下
    dianji_loc=(By.XPATH,'//*[@id="su"]')
    def dianji(self):
        self.click(self.dianji_loc)
    # 断言3
    dy3_loc=(By.CLASS_NAME,'toindex')
    def dy3(self):
        return self.text(self.dy3_loc)
    # 3.点击图片
    picture_loc=(By.XPATH,'//*[@id="s_tab_inner"]/a[2]/span')
    def picture(self):
        self.click(self.picture_loc)
    # 断言4
    dy4_loc=(By.XPATH,'//*[@id="app"]/div[2]/div[3]/div/div[1]/div/div[1]/div/div[5]/span')
    def dy4(self):
        return self.text(self.dy4_loc)
    # 4.输入框清空
    qingkong_loc=(By.XPATH,'//*[@id="image-search-input"]')
    def qingkong(self):
        self.clear(self.qingkong_loc)
    # 5.输入框再次输入 java
    send_loc=(By.XPATH,'//*[@id="image-search-input"]')
    def send(self):
        self.send_keys(self.send_loc,'java')
    # 6.点击百度一下
    dianji1_loc=(By.XPATH,'//*[@id="image-search-header"]/div/div[1]/div/div[2]/div[1]/form/span[4]/input')
    def dianji1(self):
        self.click(self.dianji1_loc)
    def luoji_baidu_02(self):
        self.luoji_baidu_01_login()
        self.search()
        self.handles()
        self.dianji()
        print(self.dy3())
        assert "百度首页" == self.dy3()
        self.picture()
        print(self.dy4())
        assert "动漫主题" == self.dy4()
        self.qingkong()
        self.handles()
        self.dianji1()